
-- 设置Leader Key为空格

local is_mac = vim.fn.has('mac') == 1 or vim.fn.has('macunix') == 1 

vim.g.mapleader = " "
vim.g.maplocalleader = " "

-- 本地变量
local map = vim.api.nvim_set_keymap
local opt = { noremap = true, silent = true }


-- ctrl + hjkl  窗口之间跳转
map('n', '<C-h>', '<C-w>h', opt)
map('n', '<C-j>', '<C-w>j', opt)
map('n', '<C-k>', '<C-w>k', opt)
map('n', '<C-l>', '<C-w>l', opt)

map('n', '<C-s>', ':w<CR>', opt)
map('v', '<C-c>', '"+y', opt)
map('n', '<C-v>', '"+p', opt)

--map("n", "sv", ":vsp<CR>", opt)
--map("n", "sh", ":sp<CR>", opt)
--map("n", "sc", "<C-w>c", opt)
--map("n", "so", "<C-w>o", opt) -- close others

-- nvim-tree
map('n', '<leader>m', ':NvimTreeToggle<CR>', opt)
map('i', '<leader>m', '<Esc>:NvimTreeToggle<CR>', opt)

-- bufferline
map("n", "<leader>b<left>",  ":BufferLineCyclePrev<CR>", opt)
map("n", "<leader>b<right>", ":BufferLineCycleNext<CR>", opt)
map('n', '<leader>bd', ':bd', opt)
-- telescope
-- map('n', '<leader>ff', ':Telescope find_files<CR>', opt)
-- map('n', '<leader>fg', ':Telescope live_grep<CR>',  opt)
-- map('n', '<leader>fb', ':Telescope buffers<CR>',    opt)
-- map('n', '<leader>fh', ':Telescope tags<CR>',       opt)

-- nvim-fzy
map('n', '<leader>ff', fzy_find(), opt)
map('n', '<leader>fg', fzy_grep(), opt)
map('n', '<leader>fb', ':lua fzy.actions.buffers()<CR>', opt)
map('n', '<leader>f/', ':lua fzy.actions.buf_lines(CR>', opt)
map('n', '<leader>ft', ':lua fzy.try(fzy.actions.lsp_tags, fzy.actions.buf_tags)<CR>', opt)
pluginKeys = {}

return pluginKeys

